<template name="merchantDetail">
  {{#if md.imgs}}
  <div class="swiper-container s7-swiper">
    <div class="swiper-wrapper">
      {{#each item in md.imgs}}
      <div class="swiper-slide pb-view">
        <img class="s7-slide" src="{{item}}">
      </div>
      {{/each}}
    </div>
    <div class="swiper-pagination"></div>
  </div>
  {{/if}}
  {{#with md}}
  <div class="s7-detail-title">
    <div class="s7-detail-title-1">{{name}}</div>
    <div class="s7-detail-title-2">
      {{>star stars = stars s_size = 14}}
    </div>
    <div class="s7-detail-title-3">
      <span class="s7-detail-p">人均：{{person_buy}}元</span>
      <a href="/merchantBuy?merchant_id={{id}}" class="external"><span class="s7-detail-buy">买单</span></a>
    </div>
  </div>
  <div class="s7-detail-title-4">
    <a href="/merchantMap/{{lng}}/{{lat}}">
    <div style="width:70%;float:left;white-space:normal; word-break:break-all;overflow:hidden;">
      {{address}}<br>
      <i class="icon iconfont icon-ditu" style="margin-top:-7px"></i>
      {{jl}}
    </div>
    </a>
    <a href="tel:{{phone}}" class="external">
      <div class="s7-m-tel" style="border:none">
      </div>
    </a>
  </div>
  {{#if boss_info.name}}
  <div class="card-content">
    <div class="list-block media-list" style="margin:5px 0">
      <span style="font-size:14px">老板故事</span>
      <ul>
        <li class="item-content s7-box-item-content" style="padding-left:5px">
          <div class="item-media">
            <img src="{{boss_info.list_image}}" width="60px" height="60px" style="border:1px solid #fff;border-radius:30px">
          </div>
          <div class="item-inner">
            <a href="/boss?merchant_id={{id}}" class="external">
              <div class="item-title-row">
                <div class="item-title">{{boss_info.name}}<span class="s7-m-span">{{boss_info.home}}</span></div>
              </div>
            </a>
            <a href="/boss?merchant_id={{id}}" class="external">
              <div class="item-subtitle s7-right-row" style="font-size:13px;margin-top:2px;white-space:normal;overflow:hidden">
                <span style="width:70%">{{boss_info.sub_content}}</span>
              </div>
            </a>
          </div>
        </li>
      </ul>
    </div>
  </div>
  {{/if}}
  {{#if sub_content}}
  <div class="s7-detail-title-4" style="margin-top:5px;height:90px;padding-left:1px">
    <div class="s7-detail-sbuy" style="border-bottom:1px solid #ddd;height:25px">
      商家简介
    </div>
    <a href="/mdetail?merchant_id={{id}}" class="external">
      <div class="s7-right-row-center" style="margin-right:15px;height:70px;overflow:hidden">
        {{sub_content}}
      </div>
    </a>
  </div>
  {{/if}}
  {{#if idles}}
  <div class="card-content">
    <div class="list-block media-list" style="margin:5px 0;">
      <ul>
        <li class="item-content" style="padding-left:5px">
          <div class="item-inner">
            <a href="/merchantBuy?merchant_id={{id}}" class="external">
              <div class="s7-detail-sbuy">
                <div class="s7-detail-sbuy-1">
                  <span class="s7-m-buy s7-color-or">买</span>
                </div>
                <div class="s7-detail-sbuy-2 s7-right-row-center">
                  {{#if idle.discount}}
                  闲惠买单，当前{{dis idle.discount}}折
                  {{else}}
                  快速买单
                  {{/if}}
                </div>
                <div class="s7-detail-sbuy-3">
                </div>
              </div>
            </a>
            {{#if strlen idle_day}}
            <div class="s7-x-detail" style="height:38px;line-height:35px">
              {{#each idle_day}}
              今日| {{start}}-{{end}} | 优惠{{dis discount}}折<br>
              {{/each}}
            </div>
            {{/if}}
            <a href="/idle?merchant_id={{id}}" class="external">
              <div class="s7-x-more">
                查看闲时规则详情&nbsp;>
              </div>
            </a>
          </div>
        </li>
      </ul>
    </div>
  </div>
  {{/if}}
  {{/with}}
  {{#if goods}}
  <div class="card-content">
    <div class="list-block media-list" style="margin:5px 0;">
      <ul>
        <li class="item-content" style="padding-left:5px">
          <div class="item-inner">
            <div class="s7-detail-sbuy">
              <div class="s7-detail-sbuy-1">
                <span class="s7-m-buy s7-color-pru">商</span>
              </div>
              <div class="s7-detail-sbuy-2">
                商品
              </div>
              <div class="s7-detail-sbuy-3">
              </div>
            </div>
            {{#each goods}}
            <div class="s7-g-detail s7-right-row-center" style="padding-left:5px !important;height:65px">
              <a href="/goodsDetail/{{id}}?merchant_id={{merchant_id}}" class="external">
                <div class="s7-g-title" style="width:100%;">
                  <div style="float:left;margin-right:5px">
                    <img src="{{list_img.path}}" width="60px" height="60px">
                  </div>
                  <div style="float:left">
                    <span class="item-title">{{name}}</span><br>
                    <span>售价:￥{{sell_price}}&nbsp;&nbsp;&nbsp;门市价:￥{{market_price}}</span>
                    <span style="float:right;margin-right:40px">已售{{buy_number}}</span>
                  </div>
                </div>
              </a>
            </div>
            {{/each}}
            {{#if goodsNum}}
            <a href="/goods?merchant_id={{md.id}}" class="external">
              <div class="s7-x-more">
                更多商品&nbsp;>
              </div>
            </a>
            {{/if}}
          </div>
        </li>
      </ul>
    </div>
  </div>
  {{/if}}
  {{#if comments}}
  <div class="card-content">
    <div class="list-block media-list" style="margin:5px 0;">
      <ul style="padding-left:10px;">
        <li>
          <div class="item-inner s7-list-li">
            {{md.comments_count}}条评论
          </div>
        </li>
        {{#each comments}}
        <li class="item-content s7-list-li s7-pad-l-0" style="align-items:flex-start">
          <div class="item-media">
            {{#if user.head_image.path}}
            <img src="{{user.head_image.path}}" width="34px" height="40px" style="border:1px solid #fff;border-radius:20px">
            {{else}}
            <img src="/img/my.png" width="34px" height="40px" style="border:1px solid #fff;border-radius:20px">
            {{/if}}
          </div>
          <div class="item-inner">
            <div class="item-title-row">
              <div class="item-title s7-size-15 s7-m-comment">
                <div>{{user.nick_name}}</div>
                <div>
                  <span style="float:left">
                    {{>star stars = stars s_size = 13}}
                  </span>
                  <span style="float:right">{{created_at}}</span>
                </div>
              </div>
            </div>
            <div class="item-subtitle" style="font-size:13px;margin-top:2px;white-space:normal">
              <span>{{context}}</span>
            </div>
          </div>
        </li>
        {{/each}}
        <li>
          <a href="/comment?merchant_id={{md.id}}" class="external">
            <div class="item-inner s7-x-more">
              更多评论>
            </div>
          </a>
        </li>
      </ul>
    </div>
  </div>
  {{/if}}
</template>
